package cvm

import (
	"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
	"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
	cvm "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312"
)

func NewCVMClient(secretId, secretKey, region string) (*CVMClient, error) {
	credential := common.NewCredential(
		secretId,
		secretKey,
	)
	cpf := profile.NewClientProfile()
	cpf.HttpProfile.Endpoint = "cvm.tencentcloudapi.com"
	// 实例化要请求产品的client对象,clientProfile是可选的
	client, err := cvm.NewClient(credential, region, cpf)
	if err != nil {
		return nil, err
	}
	return &CVMClient{
		c:      client,
		region: region,
	}, nil
}

// 负责拉取数据并完成状态
type CVMClient struct {
	// cvm 客户端
	c *cvm.Client
	// 保存Region
	region string
}
